<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="12" :lg="7" :md="8" :sm="24">
            <div class="table-operator">
              <!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
              <!--      <a-button-->
              <!--        @click="batchState(1)"-->
              <!--        type="primary"-->
              <!--        icon="check-circle"-->
              <!--        style="background: #37d75a; color: white; border: none"-->
              <!--      >启用</a-button-->
              <!--      >-->
              <!--      <a-button-->
              <!--        @click="batchState(0)"-->
              <!--        type="primary"-->
              <!--        icon="close-circle"-->
              <!--        style="background: #f47920; color: white; border: none"-->
              <!--      >禁用</a-button-->
              <!--      >-->

              <edu-button @click="handleAdd" type="primary" icon="plus" title="添加"></edu-button>
              <edu-button
                title="启用"
                @click="batchState(1)"
                type="4"
                icon="check-circle"
              ></edu-button>

              <edu-button
                title="禁用"
                @click="batchState(0)"
                type="8"
                icon="close-circle"
              ></edu-button>


              <edu-button type="1" @click="searchQuery" icon="sync" title="刷新"></edu-button>
              <!--      <a-button type="primary" icon="download" @click="handleExportXls('ve_jw_kssjd')">导出</a-button>-->
              <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
              <!--        <a-button type="primary" icon="import">导入</a-button>-->
              <!--      </a-upload>-->

              <!--      <a-dropdown v-if="selectedRowKeys.length > 0">-->
              <!--        <a-menu slot="overlay">-->
              <!--          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
              <!--        </a-menu>-->
              <!--        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
              <!--      </a-dropdown>-->
            </div>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24" style="margin-left: 2.56%">
            <a-form-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input v-model="queryParam.name" placeholder="请填写名称"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select placeholder="请选择状态" v-model="queryParam.status">
                <a-select-option value="">请选择状态</a-select-option>
                <a-select-option value="1">启用</a-select-option>
                <a-select-option value="0">禁用</a-select-option>
              </a-select>
            </a-form-item>

          </a-col>
          <a-col :xl="2" :lg="7" :md="8" :sm="24">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
              <edu-button type="5" @click="searchQuery" icon="search" title="搜索" style="margin-bottom: 0"></edu-button><edu-button
              type="7" @click="searchReset" icon="delete" title="清除" style="margin-bottom: 0"></edu-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->


    <!-- table区域-begin -->
    <div>
      <!--      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
      <!--        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项-->
      <!--        <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
      <!--      </div>-->
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{fixed:true,selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"

        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="图片不存在"
               style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="uploadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <edu-label-button type="3" @click="handleEdit(record)" title="编辑"></edu-label-button>
          <a-divider type="vertical"/>
          <edu-delete-button @click="handleDelete(record.id)" type="4" title="删除"></edu-delete-button>
          <!-- <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown> -->
        </span>

      </a-table>
    </div>

    <veJwKssjd-modal ref="modalForm" @ok="modalFormOk"></veJwKssjd-modal>
  </a-card>
</template>

<script>

  import { EduListMixin } from '@/mixins/EduListMixin'
  import VeJwKssjdModal from './modules/VeJwKssjdModal'

  export default {
    name: 'VeJwKssjdList',
    mixins: [EduListMixin],
    components: {
      VeJwKssjdModal
    },
    data() {
      return {
        description: 've_jw_kssjd管理页面',
        // 表头
        columns: [

          {
            title: '时间段名称',
            align: 'center',
            dataIndex: 'name'
          },
          {
            title: '开始时间',
            align: 'center',
            dataIndex: 'starttime'
          },
          {
            title: '结束时间',
            align: 'center',
            dataIndex: 'endtime'
          },
          {
            title: '状态',
            align: 'center',
            dataIndex: 'status_dictText'
          },

          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: '/kwgl/veJwKssjd/list',
          delete: '/kwgl/veJwKssjd/delete',
          stateBatch: '/kwgl/veJwKssjd/stateBatch',
          deleteBatch: '/kwgl/veJwKssjd/deleteBatch',
          exportXlsUrl: '/kwgl/veJwKssjd/exportXls',
          importExcelUrl: 'kwgl/veJwKssjd/importExcel'
        },
        dictOptions: {},
        isorter: []
      }
    },
    computed: {
      importExcelUrl: function() {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    },
    methods: {
      initDictConfig() {
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>